package day0720API;

import java.util.ArrayList;
import java.util.Arrays;

//集合中存储的都是对象
public class Test11 {
    public static void main(String[] args) {
        ArrayList<Integer> c=new ArrayList<>();
        c.add(1);//底层会自动将１转化为Integer对象存储
        c.add(2);
        c.add(3);
        System.out.println(c);

        Integer i1=c.get(0);
        System.out.println(i1);


        boolean rs=c.contains(3);
        System.out.println(rs);

        Integer i3=c.remove(2);//删除第index个元素,会返回删除的元素
        System.out.println(i3);

        Integer i4=c.set(1,10);//修改元素,会返回被修改的元素
        System.out.println(i4);

        Object[] is= c.toArray();//将集合ｃ转化为数组
        System.out.println(Arrays.toString(is));

        System.out.println(c.size());

        c.clear();

    }
}
